perm filename PINK.FAI[HAK,ROB]1 blob
sn#430974 filedate 1979-04-03 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00007 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 TITLE PINK
C00045 00003 BufIni: Initialize buffer area into linked list
C00047 00004 AllWho: Fill WhoLine records with information on all jobs
C00049 00005 AllSorts: Sort a WhoLine array into people, phantoms, and segments.
C00052 00006 PerSort:
C00053 00007 executable code
C00054 ENDMK
C⊗;
TITLE PINK
; see also WHOPHN.FAI[S,MRC]
; ac definitions
AC1 ← 1;
AC2 ← 2;
AC3 ← 3;
AC4 ← 4;
AC5 ← 5;
P ← 17;
210←←JBTSTS ;
211←←PRJPRG ;
222←←JOBN-1 ;
SET JobRec,0 ; Job Info Record Definition
USE JobRec
JR.Next: BLOCK 1 ; Link to next record
JR.JobN: BLOCK 1 ; Job number of this record
JR.PPN: BLOCK 1 ; Sixbit PPN for this job
JR.Stat: BLOCK 1 ; Status word (from JBTSTS) for this job
JR.SWar: BLOCK 1 ; Spacewar info for this job
JR.RTim: BLOCK 1 ; Runtime for this job
JR.JobQ: BLOCK 1 ; Current queue for this job
JR.Alia: BLOCK 1 ; Sixbit Alias for this job
JR.TTY: BLOCK 1 ; Controlling TTY for this job
JR.JNam: BLOCK 1 ; Sixbit Job Name for this job
JRLength ←← . ; Length of this record
USE
; Masks for left half of words returned by a JBTSTS UUO.
RealJob ←← 40000 ; The job is either a person, phantom, or segment
LogdIn ←← 10000 ; The job is logged in, so it is a real person
IsSeg ←← 1000 ; The job is a segment
RecBuf: BLOCK RecLen*MaxJob ; Storage for WhoLine records
COMMENT ⊗
APPENDIX 3--LOW CORE ADDRESSES OF USEFUL POINTERS IN THE MONITOR
The table below lists the contents of some absolute locations in the monitor.
These locations contain pointers to various system tables (such as the job table
of login PPNs), pointers to special words (monitor variables), and system
parameters (such as the highest legal job number). Any word in memory may be
examined by use of either the PEEK UUO (see page 200) or the SETPR2 UUO (see
page 164).
To get the address of a particular job's entry in a job table, add the job
number to the base address of the table.
WORD CONTENTS EXPLANATION
210 JBTSTS This is the address of the job table of status words. The
bits in each entry are explained with the JBTSTS UUO on page
197.
211 PRJPRG This is the address of the job table of project-programmer
names.
212 JBTSWP This is the address of the job table of swapper data. The
left half (bits 0:17--the 777777,,0 bits) of each entry
contains 400000+the first logical band number used to swap
this job. Bits 18:26 (0,,777000 bits), called IMGOUT,
contain the size of the job (in pages) as stored on the
disk. Bits 27:35 (0,,777 bits), called IMGIN, contain the
size of the job (in pages) as it will appear when it is
swapped in.
213 SPWGO This is the address of the job table of P1 spacewar
processes. The right half (bits 17:35--0,,777777 bits) of
each entry contains the user-specified starting address of
the spacewar process. Bits 14:17 (17,,0 bits) contain the
number of ticks between startups, and bits 10:13 (36,,0
bits) contain the number of ticks until the next startup.
This word is zero for jobs that do not have P1 spacewar
processes running. See Section 8.
214 TTIME This is the address of the job table of total run times (in
ticks). The time for job 0 is the null time (idle time)
since the last system reload.
215 UPTIME This is the address of a word that contains the length of
time in ticks since the last system reload.
216 CORMAX This is the address of a word that contains the largest size
(in words) a user program can be and still fit in core.
217 DEVLST This is the address of the header word for the list of all
device data blocks (DDBs). The left half of the header word
contains the address of the first DDB. DDBs are described
in Appendix 4.
220 TTYTAB This is the address of the table of pointers to TTY DDBs.
Index into this table with the terminal line number. The
entry for a terminal not in use is zero. The entry for a
terminal in use contains the following information.
BITS OCTAL NAME CONTENTS OF FIELD IN TTYTAB ENTRY
0 400000,,0 COMBIT This bit is on if the terminal has a
monitor command yet to be processed.
1 200000,,0 DLYBIT This bit is on if the terminal has a
delayed command yet to be processed.
2 100000,,0 PAUSEB This bit is on if the terminal has a
command waiting for the output buffer to
empty.
3 40000,,0 KILTTY TTYSER has called TTYKIL for this
terminal and is through with the DDB,
which will be released by DPYKIL when and
if the DPY header is released.
11:17 177,,0 (talk) If the terminal is in a talk ring, this
field contains the line number of the
next terminal in the ring. Otherwise,
this field contains the terminal's own
line number.
18:35 0,,777777 (DDB) This is the address of the terminal's
DDB.
221 BYTE (9) SCNNUM,DPYNUM,DDNUM,PTYNUM These four quantities are the
numbers of 1) teletype lines, 2) III display lines, 3) Data
Disc display lines and 4) pseudo-teletype lines,
respectively.
222 JOBN-1 This is the highest possible job number.
223 CHKBEG This is the first location in the checksummed part of the
system
224 JBTQ This is the address of the job table of entries in the job
queues. The queues are circular with each entry containing
a forward pointer in the right half and a backward pointer
in the left half. The pointers are all relative to JBTQ: a
pointer that is positive points to another job's entry in
the table; a pointer that is negative points to the queue's
header word, which itself is just another entry in the
circular queue and which contains both forward and backward
pointers. The magnitude of a negative pointer indicates the
number of the queue the entry is in. See also the contents
of absolute locations 231, 234, and 235 below and the queue
names and numbers in Appendix 5.
225 JOBNAM This is the address of the job table of sixbit job names.
226 JOB This is the address of a word that contains the number of
the currently running job.
227 CONFIG This is the address of an asciz string that gives the title
of the current system.
230 SP2GO This is the address of the job table of P2 spacewar
processes. The format of this table is the same as that of
the SPWGO table; see word 213 above.
231 JOBQUE This is the address of the job table of queue numbers. Each
entry in this table contains either the queue number or the
negative of the queue number for the particular job. See
the queue names and numbers in Appendix 5.
232 JBTPRI This is the address of the job table of calculated
priorities.
233 JBTJL This is the address of the job table of pointers to
instantaneous job load tables.
234 NQUES This is the number of different queues. The queues are
numbered from 0 to this number. See the queue names and
numbers in Appendix 5.
235 QNAMS This is the address of a table of the ascii names of the
various queues. Index into this table with the queue's
number. These names are also listed in Appendix 5.
236 JBTLIN This is the address of the job table of attached terminals.
The entry in this table will be -1 for a detached job. For
an attached job the entry will contain the terminal line
number in the right half and the permanent terminal line
characteristics in the left half. There may be bits on for
non-permanent characteristics, but these bits are not kept
up to date in this word. See LINTAB in word 302 below for
the current line characteristics; see also the GETLIN UUO on
page 77.
237 LETAB+20 This is the address of the entry for the first III (TTY20)
in the table of pointers to the displays' line editor
headers (DPY headers). The right half of each entry
contains a pointer to the free storage block for that
display. The left half holds various flags used by the line
editor. When a display is not in use, its entry here is
zero. Index into LETAB with a terminal's line number.
240 JBTJLH This is the address of the job table of oldest job loading.
241 STATS This is the address of a table of system statistics.
242 JBTGSL This is the address of the job table of guaranteed service
level.
243 STATLEN This is the length of the STATS table of system statistics.
244 STATPTR This is the address of a byte pointer into the STATS table
of system statistics.
245 STATNUM This is the address of a word containing the number of times
the STATS table has been filled.
246 INTIME This is the address of a word containing the number of ticks
(one tick=1/60th of a second) the system has spent at
interrupt level since the system has been up.
247 STBEG This is the address of another table of system statistics.
250 JBTKCJ This is the address of the job table of kilo-core-jiffies
(KCJs) used by each job. A jiffie is a tick, i.e., 1/60th
of a second. One KCJ represents a job running for one tick
with 1K of core.
251 JBTBTM This is the address of the job table of login times. Each
entry in this table contains the date and time when the
particular job logged in, with the date (in system date
format) in the left half and the time (in seconds after
midnight) in the right half.
252 DQCNT This is the address of a word containing the number of disk
operations waiting to be started.
253 TTYLOK This is the address of a word used as a flag to prevent
users from typing anything on their terminals.
254 MAINTMODE This is the address of a word used as a flag to indicate
that system maintenance is going on.
255 CORPTR This is address of a block of words describing the state of
the swapper. The first 4 words are 0, FINISH, FORCE, and
FIT.
256 LASTDISASTERTIME This is the address of a word containing the system
uptime when the last disaster occurred.
257 (unused)
260 STEND2 This is the address of the last word in the table of system
statistics beginning at STBEG (see above).
261 (unused)
262 EXPMOD This is the address of a word used as a flag to LOGIN to
type out the file X.TXT[2,2].
263 (unused)
264 FSRPQ This is the address of a table containing the number of free
storage requests by size.
265 SYSTOP This is the address of a word that contains the physical
address of the first word after the system (where free
storage begins).
266 CORTAB This is the address of a table that indicates the usage of
each page of core. There is one word per core page. The
interesting part of each word is a 9-bit byte in bits 18:26
(0,,777000 bits). This field for a given page contains
either 1) the number of the job occupying the page, 2) a 101
if the page is part of the system, 3) a 103 if the page is
non-existant, 4) a 105 if the page is part of free storage,
5) a 110 if the page is a page map, or 6) a 0 if the page is
unused.
267 NOLOGIN This is the address of a word used as a flag to prevent
anyone from logging in.
270 PTYJOB This is the address of the table of owners of
pseudo-teletypes (PTYs). Each entry contains the number of
the job that owns that PTY. Index into this table with the
PTY line number minus 121.
271 JBTPRV This is the address of the job table of active privileges.
272 UCLLEN*1000+UCLDLN,,UCLTAB The right half of this word contains
UCLTAB which is the address of the CALL UUO name table.
This table is made up of two parts. The first UCLDLN words
contain the names of DEC CALLs, and the next UCLLEN-UCLDLN
words contain the names of the special Stanford CALLs
(numbers from 400000 up). Thus the total length of the
table is UCLLEN, which is in bits 0:8 (777000,,0 bits) of
word 272; the length of the first part of the table, UCLDLN,
is in bits 9:17 (777,,0 bits) of word 272. The CALL names
within each part are in their expected order by CALLI
number.
273 DSKPPN This is the address of the job table of Disk PPNs (ALIASes).
If a job has no ALIAS, its entry in this table is zero.
Disk PPNs are explained on page 20.
274 FTIME This is the address of the job table containing each job's
time last run. Each entry contains the date and time when
the particular job was last run, with the date (in system
date format) in the left half and the time (in seconds after
midnight) in the right half.
275 NJOBS This is the address of the job table that gives the number
of users for each upper segment. Each entry contains the
number of jobs attached to the given upper segment. Index
into this table with the upper segment's job number.
276 DSKOPS This is the address of the job table containing the number
of disk operations each job has done. The entry for job 0
is the total number of disk operations since the system was
reloaded.
277 INITIM This is the address of a word that contains the date and
time of the last system reload. The date (in system date
format) is in the left half and the time (in seconds after
midnight) is in the right half.
300 -DISPL,,COMTAB COMTAB is the address of the table of monitor
commands names in sixbit, and DISPL is the number of
commands in that table.
301 (unused)
302 LINTAB This is the address of the table of terminal line
characteristics. Each entry in this table corresponds to a
particular terminal. The terminal's line characteristics
are in the left half (see the GETLIN UUO on page 77 for the
meanings of these bits). The right half is used to store
ESCAPE/BREAK arguments (for terminals that are displays).
Index into this table with terminal's line number.
303 ASTAB This is the address of the audio switch connection table.
There is a word here for each III and Data Disc display;
index into this table with the display's line number minus
20. The data in each entry of this table is as follows (for
more details about the audio switch, see Section 4.9):
BITS OCTAL VALUES OF FIELDS IN ASTAB ENTRY
0 400000,,0 One if a UUO is waiting for a temporary connection
to finish on this display.
1 200000,,0 One if the current connection is a temporary
connection.
2 100000,,0 One if a page interruption is happening at this
display.
3 40000,,0 One if a delayed beep is pending.
4 20000,,0 One if the permanent audio channel is not page
interruptible.
5 10000,,0 One if the permanent channel is not beep
interruptible.
6:7 6000,,0 Beep disposition for temporary channel.
8:9 1400,,0 Page disposition for temporary channel.
10:13 360,,0 Temporary channel number.
14:17 17,,0 Permanent channel number.
18:35 0,,777777 Remaining duration of temporary connection (0 for
infinite).
304 JB2PRV This is the address of the job table of passive privilege
bits.
305 -LFTLEN,,LFTTAB This word contains the number (LFTLEN) and address
(LFTTAB) of the table of left-half privilege bits and their
names. Each entry in this table is of the form <sixbit
name>,,<half-word bit value>.
306 -RHTLEN,,RHTTAB This word contains the number (RHTLEN) and address
(RHTTAB) of the table of right-half privilege bits and their
names. Each entry in this table is of the form <sixbit
name>,,<half-word bit value>.
307 JBTSIN This is the address of the job table of entries in the list
of jobs to be swapped in.
310 JBTGLU This is the address of the job table of cells used to mark
jobs which must not be swapped out.
311 JOBNM1 This is the address of a word containing the current maximum
number of jobs the system can support.
312 DDFCNT This is the address of a word containing the number of Data
Disc channels that are currently available.
313 DSTBLN,,DSTBUF This word contains the length (DSTBLN) and address
(DSTBUF) of a table of statistics for the disk.
314 COMWHO This is the address of the first of several words used to
hold the system wholine in ascid representation for
displaying. The system wholine ends with a CR and LF.
315 NPARIN This is the address of a word which contains the number of
parity errors detected with indeterminate locations. The
word at NPARIN-1 is called NPARER and contains the total
number of parity errors detected.
316 JBTMAP This is the address of the job table of pointers to each
job's page map.
317 XMSET This points to 9 words of XGP default settings for TMAR,
PMAR, BMAR, LMAR, RMAR, XLINES, XTNODE, XVNODE and XGPBLN.
(XGPBLN is not settable by users.)
320 RTRHCT This points to a table of error counts for the disk per head
per pack.
321 TBLKPT,,TPJMP Offsets within the piece of paper control block.
322 DPHPOS,,PPCALL Offsets within the piece of paper control block.
323 PPRJMP,,PPNO Offsets within the piece of paper control block.
324 JBTPAG This is the address of the job table of core image sizes.
The left half of each entry contains the size of the job in
pages; the right half contains the number of pages that are
above FSLIMIT.
Core is divided into three major parts, which are, in order
of physical addresses (lowest first): SYSTEM, FREE STORAGE,
USERS. The system part occupies a fixed amount of core (in
a given version), and its ending address is stored in
SYSTOP. Free storage grows and shrinks as more or less core
is needed, and its ending address is stored in FSTOP.
(SYSPAG and FSPAG contain page rather than word versions of
the same ending addresses.) It does not matter where the
256K word boundary is, as long as it is after the end of
free storage. User core is everything after FSTOP. If free
storage needs to expand, then the user at FSTOP is swapped
out. If a job were locked in core at FSTOP he might get
swapped out. To get around this, user core is divided into
two regions, high and low, which are exactly the same,
except that locked jobs exist completely within the high
region. The dividing line between the high and low regions
is called FSLIMIT and is set big enough so that free storage
will never get that big. The process of locking a job in
core involves first checking to see if it is entirely in the
high region. If it is, the JLOCK bit is set in JBTSTS and
the job is considered locked. If not, then the job is
swapped out and the LOKSWP bit is set instead. This bit
indicates to the swapper that the job must be swapped into
the high region. The job will be swapped in when there is
enough high region core available for it and then the LOKSWP
bit will be turned off and the JLOCK bit turned on.
325 MTRLST This is the address of the first word of a linked list of
meter control blocks used by the system when the performance
meter is in "background" mode.
326 SKIPP1 This is an I/O instruction to execute which will skip if it
is executed on processor 1 (P1).
327 SKIPP2 This is an I/O instruction to execute which will skip if it
is executed on processor 2 (P2).
330 LEBUF Offset within the DPY header of the line editor buffer.
331 LDSHF*1000+LDPWR,,LDAVG LDAVG contains the current load average
multiplied by 2↑(LDPWR+LDSHF). The load average is updated
every 60th of a second by adding the following value to
LDAVG: Q * 2↑LDSHF - OLD.LDAVG * 2↑(-LDPWR), where Q is
the instantaneous number of jobs in the RUNQ and TQ, and
OLD.LDAVG is the previous value in LDAVG. Thus, the load
average is the smoothed average of the number of jobs in
RUNQ or TQ, where the smoothing period is 2↑LDPWR 60ths of a
second.
332 DDQSIZ This is the address of a word containing the size of the
queue of terminals waiting for Data Disc channels.
333 DDQREQ,,LSTESC LSTESC is a table with one word per terminal.
Contained in LSTESC are the Data Disc channel wait queue,
the last escape command typed on each (physical) terminal,
and the physical terminal "responsible" for each logical TTY
line. The responsible terminal is the last terminal to type
a character (while mapped) to the given logical TTY line.
To find the terminal responsible for a logical TTY line,
index into LSTESC with the logical TTY line number and pick
up a byte from the indexed word with the byte position
DDQREQ.
334 LEPOS Offset within the DPY header of the line editor position
word. If the line editor for this display has been
positioned by an LEYPOS UUO, then the sign-bit of this word
will be on and the position of the line editor (in LEYPOS
format, see page 131) will be the two's complement value in
bits 11:21 (177,,740000) of this word.
335 VDTIE This is the table that tells what Data Disc line number each
TV monitor (Data Disc display) is tied to. Index into this
table with the TV monitor number minus 26. The entry
contains the line number that the given TV monitor is tied
to, or zero if the TV monitor is untied. See the VDSMAP UUO
on page 152 for an explanation of tied and untied TV
monitors.
(END COMMENT) ⊗;
BufIni: ; Initialize buffer area into linked list
COMMENT ⊗
This procedure will turn a block of uninitialized storage into a linked
list of 'WhoLine' records. The link word of each record points to the
next. The last record of the list has a null(0) link word.
The job number for the corresponding record is also initialized.
INPUTS:
AC1: pointer to first word of array to be initialized
OUTPUTS:
AC1: pointer to first record of linked list
REGISTER USAGE:
AC1: Pointer to Previous record under consideration
AC2: Pointer to Current record under consideration
AC3: Current job # under consideration
⊗;
PUSH P,AC1 ;
PUSH P,AC2 ;
PUSH P,AC3 ;
MOVEI AC3,LoJob ; Initialize MaxJob records
MOVE AC2,AC1 ; This ← first record
JRST BufEntr ; jump into loop
Bufloop: ;
MOVE AC1,AC2 ; Prev ← This
ADDI AC2,RecLen ; point to next record
MOVEM AC2,Next(AC1) ; point Next(Prev) to This
BufEntr: ;
SETZM ,Next(AC2) ; clear Next(This)
MOVEM AC3,JobN(AC2) ; set JobNumber for this record
AOJ AC3, ; next job
CAIG AC3,HiJob ; until all jobs done
JRST Bufloop ;
POP P,AC3 ;
POP P,AC2 ;
POP P,AC1 ;
POPJ P,
AllWho: ; Fill WhoLine records with information on all jobs
COMMENT ⊗
This procedure will fill up a linked list of WhoLine records with information
on all jobs.
INPUTS:
AC1: pointer to first record of a linked list of WhoLine records
OUTPUTS:
each record filled with appropriate job info
REGISTER USAGE:
AC1: pointer to Current record under consideration
AC2: Current job under consideration
AC3: general bit slinging
⊗;
PUSH P,AC1 ;
PUSH P,AC2 ;
PUSH P,AC3 ;
Allloop: ;
MOVE AC2,JobN(AC1) ; fetch job number of this record
MOVE AC3,AC2 ;
JBTSTS AC3, ; fetch job status word for current job
MOVEM AC3,Stat(AC1) ; and store in Stat field of current record
HRRZ AC3,AC1 ;
ADDI AC3,Text ; set pointer to text field of current record
HRL AC3,AC2 ; left half gets job #
WHO AC3, ; fetch wholine text for current job
MOVE AC1,Next(AC1) ; next record
JUMPN AC1,Allloop ; until at end of list
POP P,AC3 ;
POP P,AC2 ;
POP P,AC1 ;
POPJ P,
AllSorts: ; Sort a WhoLine array into people, phantoms, and segments.
COMMENT ⊗
This procedure will process the information found in a wholine array
(as filled by the AllWho routine), and return with pointers to three
linked lists within the array: a list of people logged in, a list of
pantom jobs, and a list of upper segments.
INPUTS:
AC1: pointer to first record of a linked list of WhoLine records
OUTPUTS:
AC1: pointer to first record of a linked list of people
AC2: pointer to first record of a linked list of phantoms
AC3: pointer to first record of a linked list of upper segments
REGISTER USAGE:
AC4: pointer to Current record under consideration
⊗;
PUSH P,AC4 ;
PUSH P,AC5 ;
MOVE AC4,AC1 ; look at first record
SortLoop: ;
MOVE AC5,Stat(AC4) ; fetch job status
TLNE AC5,RealJob ; is it a job at all?
JRST NextJob ; no - skip it
TLNE AC5,LogdIn ; is it logged in?
JRST NotHuman ; no - its not a human
GotPerson: ; this one is a real live human's job
MOVE AC1,JobN(AC4)
MOVEI AC2,1 ;
JRST NextJob ; go look at next job
NotHuman: ; Either a segment or a pantom
TLNE AC5,IsSeg ; is it a segment?
JRST GotFantom ; no - it is a segment
GotSegment: ; this one is a segment
JRST NextJob ; go look at next job
GotFantom: ; this one is a phantom, sort onto Fantom list
JRST NextJob ; go look at next job
NextJob:
MOVE AC4,Next(AC4) ; This ← NEXT(This)
JUMPN SortLoop ; Loop until entire list has been scanned
POP P,AC5 ;
POP P,AC4 ;
POPJ P, ;
PerSort:
MOVE AC1,Jobn(AC4)
MOVEI AC2,1
POPJ P,
FanSort:
MOVE AC1,Jobn(AC4)
MOVEI AC2,2
POPJ P,
SegSort:
MOVE AC1,Jobn(AC4)
MOVEI AC2,3
POPJ P,
; executable code
start:
MOVE P,pdlptr ;
MOVEI AC1,RecBuf ;
PUSHJ P,BufIni ; Initialize the FS region
; MOVEI AC1,RecBuf ;
PUSHJ P,AllWho ; Gather information on all the jobs
; MOVEI AC1,RecBuf ;
PUSHJ P,AllSorts ; Sort the records into people, phantoms, and Devos
EXIT
END start